//属性配置
type ElementProps = {
  // 布局属性
  direction?: 'horizontal' | 'vertical'
  // 通用属性
  width?: string
  height?: string
  // Element Plus注入属性
  [key: string]: any
}

//事件配置
type EventConfig = Record<string, (e: Event) => void>
//插槽配置
type SlotConfig = {
  name: string
  content: string | ComponentConfig | ComponentConfig[]
}
//组件配置
type ComponentConfig = {
  id?: string
  component: any
  props?: ElementProps
  children?: ComponentConfig[]
  slots?: SlotConfig[]
  events?: EventConfig
  style?: Record<string, string>
}

type SizeType = 'small' | 'medium' | 'large'
type ButtonGroupType = 'primary' | 'success' | 'warning' | 'danger' | 'info'
type ButtonType = ButtonGroupType | 'default' | ''
type InputType =
  | 'text'
  | 'textarea'
  | 'password'
  | 'number'
  | 'url'
  | 'email'
  | 'tel'
  | 'date'
  | 'week'
  | 'month'
  | 'datetime'
  | 'datetimeLocal'
  | 'time'
  | 'color'
  | 'button'
type OffOnType = 'on' | 'off'
type ResizeType = 'none' | 'both' | 'horizontal' | 'vertical'
/** blur 当选择器的输入框失去焦点时触发
    focus 当选择器的输入框获得焦点时触发
  change 当选择框的值发生改变时触发
  input 当选择框的值发生改变时触发
  clear 当点击由 clearable 属性生成的清空按钮时触发
  keydown 当键盘按键被按下时触发
  mouseenter 当鼠标进入时触发
  mouseleave 当鼠标离开时触发
  compositionstart 当输入法组合文字开始输入时触发
  compositionupdate 当输入法组合文字输入时触发
  compositionend 当输入法组合文字输入完成时触发
   */
type InputEventType =
  | 'blur'
  | 'focus'
  | 'change'
  | 'input'
  | 'clear'
  | 'keydown'
  | 'mouseenter'
  | 'mouseleave'
  | 'compositionstart'
  | 'compositionupdate'
  | 'compositionend'
type ArrayType = string[] | number[] | boolean[] | object[]
type BaseType = string | number | boolean | object
type ModelValueType = BaseType | ArrayType
export type {
  ComponentConfig,
  SizeType,
  ButtonGroupType,
  ButtonType,
  InputType,
  OffOnType,
  ResizeType,
  InputEventType,
  ModelValueType,
}
